<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        img {
            width: 800px;
            height: 500px;
        }
    </style>
</head>

<body>
    <button id="zjl">周杰伦</button>
    <button id="ljj">林俊杰</button>
    <img src="../images/zjl.jpg " alt="" title=" 周杰伦 ">

    <script>
        //修改元素属性 src
        //1. 获取元素
        var zjl = document.getElementById('zjl');
        var ljj = document.getElementById('ljj');
        var img = document.querySelector('img');
        // 2.注册事件 处理程序
        ljj.onclick = function() {
            img.src = '../images/ljj.jpg';
            img.title = '林俊杰'
        }
        zjl.onclick = function() {
            img.src = '../images/zjl.jpg';
            img.title = '周杰伦'
        }
    </script>
</body>

</html>